package com.bjwl.modules.back.controller;

import com.bjwl.common.utils.R;
import com.bjwl.modules.back.entity.CourseContentEntity;
import com.bjwl.modules.back.form.ComboxDataVO;
import com.bjwl.modules.back.services.ComboxDataService;
import com.bjwl.modules.back.services.CourseContentService;
import com.bjwl.modules.constant.DataDictionary;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;
import java.util.Map;



/**
 * 资料详细记录表
 *
 * @author guoyp
 * @email guoyp2126@163.com
 * @date 2021-11-20 17:22:25
 */
@RestController
@RequestMapping("back/coursecontent")
public class CourseContentController {
    @Autowired
    private CourseContentService courseContentService;


    @Autowired
    private ComboxDataService comboxData;


    /**
     * 资料列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
       // PageUtils page = courseContentService.queryPage(params);

        return R.ok();
    }


    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody CourseContentEntity courseContent){
			courseContentService.save(courseContent);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody CourseContentEntity courseContent){
			courseContentService.updateById(courseContent);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
			courseContentService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

    public R stuffType(){

        List<ComboxDataVO> stuffType = comboxData.GetCodeByType(DataDictionary.stuff_TYPE);

        return R.ok().put("data",stuffType);
    }

}
